home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Suzy B Software 2
/
Suzy B Software CD-ROM 2 (1994).iso
/
adult_ed
/
weather
/
weather.doc
< prev
next >
Wrap
Text File
|
1995-05-02
|
8KB
|
158 lines
WEATHER.DOC
Nov 15, 1990
Original BASIC version: Phil Baughn
Revised C version: Rod Falanga
WEATHER is a program that Phil Baughn wrote for
forecasting the weather as well as to calculate the wind
chill factor, the heat index, the humidity index and the dew
point. Phil wrote the program for the IBM PC and compatibles
in BASIC. Others also assisted in the creation of WEATHER,
they are Brad James, A. Blackadar and others, who are
mentioned in the source code.
I wanted to have the program on my Atari ST, and since
ST BASIC's floating point calculations are notoriously bad
and since I don't have GFA BASIC, I thought it best to
translate Phil's most recent copy of WEATHER into C. After
approximately three months, this is the result. As Phil has
requested in his BASIC source code, I now also request that,
if you should give this program to anyone else, upload it to
a BBS or some other electronic bulletin board system, please
keep this documentation file with it. Thank you.
The BASIC version of WEATHER is shareware and any monies
are to be sent to Phil Baughn for it. This C version is also
shareware and I request that if you find it useful, that you
send whatever you consider appropriate to me at: 740
Stallion Rd., SE; Rio Rancho, NM 87124.
Phil's BBS is The MAILROOM RBBS-PC in Lexington, KY.
You may reach it (data) by dialing (606)263-1234.
Included in this archive file are the following:
WEATHER.C
HEATINDX.C
DEW_PT.C
FORECAST.C
HUMIDITY.C
WINDCHIL.C
WEATHER.BAS (the original BASIC version)
WEATHER.TOS (in the Atari ST related archive only)
WEATHER.DOC (this text file)
MAKEFILE (the Mark Williams C makefile file)
Some of the modules need some explanation. The
HEATINDX, DEW_PT, FORECAST, HUMIDITY and WINDCHIL modules are
basically what their names imply. For the most part, I have
left Phil's program design and logic untouched. Phil
apparently was using a version of BASIC which does not have
included the IF THEN ... ELSE IF ... ELSE ... END IF
structure, as belatedly I discovered that that is what he was
doing throughout much of the FORECAST routine and supporting
subroutines. I had however already embarked on a scheme of
duplicating his logic when I finally figured this out. Since
as I believe, Phil was working with a BASIC with limited
programming structure, the routine FORECAST was extremely
difficult to translate into a more structured representation.
I finally gave up the attempt and essentially copied the
logic verbatim. I sincerely hope that my attempts at
reproducing the FORECAST module have not been damaging to
it's functionality or it's performance.
WEATHER.C contains the main routine which interfaces
with the User. It also contains all of the supporting I/O
routines, namely PRINT and GET_STRING. I wanted to write
this so that it could be as portable as possible. Therefore,
I decided to put all of the I/O routines into one place,
where they might easily be modified and maintained, leaving
the forecasting, wind chill calculating, etc. routines in
their own modules where only the implementation for that
module is contained.
I wrote this source code on a VAX using VMS. And then I
downloaded it to my 1040ST where I wrote the Mark Williams
MAKEFILE and then compiled it. As it is currently, this
program will compile, link and run on either a VAX running
VMS or an Atari ST, without modifications. (That's the whole
idea of portability, isn't it?)
There are a few explanations in the code for those who
wish to modify it. First of all, I wanted to use the ANSI
standard for program development. VAX C version 3.0, is not
completely ANSI compliant (although Digital is working on
it.) Therefore I couldn't use the ANSI defined macro
"__STDC__". When I downloaded the file from the VAX to my
ST, I went through all of the C code and changed the VAX C
predefined macro "VMS" to "__STDC__". However, much to my
dismay, Mark Williams C version 3.0, which is **NOT** ANSI
compliant, recognized the macro!! Therefore, in order to
make the program compile correctly, I went back through the
code and substituted back the string "VMS" for the string
"__STDC__". Therefore, if you have an ANSI compliant C
compiler, I would suggest that you substitute the string
"__STDC__" for the string "VMS" throughout the C source code.
There is only one exception to this, and that is in those
places where I include files for the VAX C compiler. I have
included header files from the text libraries that are
available in VAX C, since this speeds compilation. In those
instances, I suggest that you modify the #includes to look
something like this:
#include stdio -> #include <stdio.h>
Unless you plan on compiling this on a VAX, of course.
There is one last item which needs to be addressed.
throughout many (if not most) of the modules, I have used a
routine called uppercase(). However, I did not include the
source code for this routine in the archive. I didn't do
that for a very simple reason: uppercase() is one of those
routines that all beginning C programmers are likely to write
when first learning C, and so they may very well have a
version or two of it hanging around. I didn't want to burden
you with yet another version. uppercase() takes a single
argument which is a pointer of type char which points to a
null terminated string. As the name of the routine suggests,
it will turn all of the lower case letters in the string to
upper case and leave everything else untouched. My version
of uppercase() also returns the pointer which it has
uppercased. I **DO NOT** allocate memory for another
string!! I do the upper casing activity in place and return
the pointer which was passed in, so that I can use
uppercase() as an argument to such things as printf().
(e.g.: printf("You typed this %s\n", uppercase(response))
). Using ANSI standard function protocols, uppercase() is
defined as follows:
char *uppercase(char *)
For good old traditional Kernighan & Ritchie ("classic C"?),
it would be:
char *uppercase()
Now for the necessary stuff. VAX, VAX C, VMS and
DEC are registered trademarks of Digital Equipment
Corporation, headquartered in Maynard, Massachusets. IBM,
IBM PC are registered trademarks of International Business
Machines. Atari and Atari ST are registered trademarks of
the Atari Corporation.
Phil Baughn and myself are in no way responsible for any
damage caused by this program.
My address is:
Rod Falanga
740 Stallion Road, Southeast
Rio Rancho, New Mexico 87124
I am on GEnie and can be reached at GEnie mail-ID
R.FALANGA1.